package c.d.a.e; import android.content.Context; import android.graphics.Color; import android.graphics.Rect; import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.LayerDrawable; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.widget.TextView; import c.d.a.b; import kotlin.KotlinVersion; public abstract class a extends b { public int g; public int h; public int i; public float j = 12.0f; public int k = 3; public Integer l; public View.OnClickListener m; public boolean n = true; public int o = Color.parseColor("#1E88E5"); public TextView p; public float q = -1.0f; public float r = -1.0f; public float s = -1.0f; public a(Context context, AttributeSet attributeSet) { super(context, attributeSet); b(); this.n = attributeSet.getAttributeBooleanValue("http://schemas.android.com/apk/res-auto", "animate", true); setAttributes(attributeSet); this.f1678e = this.o; if (this.l == null) { this.l = Integer.valueOf(a()); } } public int a() { int i2 = this.o; int i3 = (i2 >> 16) & KotlinVersion.MAX_COMPONENT_VALUE; int i4 = (i2 >> 8) & KotlinVersion.MAX_COMPONENT_VALUE; int i5 = (i2 >> 0) & KotlinVersion.MAX_COMPONENT_VALUE; int i6 = i3 - 30; if (i6 < 0) { i6 = 0; } int i7 = i4 - 30; if (i7 < 0) { i7 = 0; } int i8 = i5 - 30; if (i8 < 0) { i8 = 0; } return Color.rgb(i6, i7, i8); } public void b() { setMinimumHeight(c.d.a.d.a.a((float) this.h, getResources())); setMinimumWidth(c.d.a.d.a.a((float) this.g, getResources())); setBackgroundResource(this.i); setBackgroundColor(this.o); } public float getRippleSpeed() { return this.j; } public String getText() { return this.p.getText().toString(); } public TextView getTextView() { return this.p; } public void onFocusChanged(boolean z, int i2, Rect rect) { if (!z) { this.q = -1.0f; this.r = -1.0f; } } public boolean onInterceptTouchEvent(MotionEvent motionEvent) { return true; } public boolean onTouchEvent(MotionEvent motionEvent) { View.OnClickListener onClickListener; invalidate(); if (isEnabled()) { if (motionEvent.getAction() == 0) { this.s = (float) (getHeight() / this.k); this.q = motionEvent.getX(); this.r = motionEvent.getY(); } else if (motionEvent.getAction() == 2) { this.s = (float) (getHeight() / this.k); this.q = motionEvent.getX(); this.r = motionEvent.getY(); if (motionEvent.getX() > ((float) getWidth()) || motionEvent.getX() < 0.0f || motionEvent.getY() > ((float) getHeight()) || motionEvent.getY() < 0.0f) { this.q = -1.0f; this.r = -1.0f; } } else if (motionEvent.getAction() == 1) { if (motionEvent.getX() > ((float) getWidth()) || motionEvent.getX() < 0.0f || motionEvent.getY() > ((float) getHeight()) || motionEvent.getY() < 0.0f) { this.q = -1.0f; this.r = -1.0f; } else { this.s += 1.0f; if (!this.n && (onClickListener = this.m) != null) { onClickListener.onClick(this); } } } else if (motionEvent.getAction() == 3) { this.q = -1.0f; this.r = -1.0f; } } return true; } public abstract void setAttributes(AttributeSet attributeSet); public void setBackgroundColor(int i2) { this.o = i2; if (isEnabled()) { this.f1678e = this.o; } try { ((GradientDrawable) ((LayerDrawable) getBackground()).findDrawableByLayerId(b.shape_bacground)).setColor(this.o); this.l = Integer.valueOf(a()); } catch (Exception unused) { } } public void setOnClickListener(View.OnClickListener onClickListener) { this.m = onClickListener; } public void setRippleSpeed(float f) { this.j = f; } public void setText(String str) { this.p.setText(str); } public void setTextColor(int i2) { this.p.setTextColor(i2); } }